<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    class Phone {
      constructor(name, price) {
        this.name = name;
        this.price = price;
      }
      call() {
        console.log('打电话');
      }
    }
    // 继承
    class SmartPhone extends Phone {
      constructor(name, price, color) {
        super(name, price);
        this.color = color;
      }
      playGame() {
        console.log('打游戏');
      }
      // 重写父类的 call 方法
      call() {
        console.log('视频通话');
      }
    }

    let p = new SmartPhone('iPhone', 8888, 'red');

    console.log(p.call);

  </script>
</body>

</html>